#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QtGui>

namespace Ui {
class MainWidget;
}

class MainWidget : public QWidget
{
	Q_OBJECT
	
public:
	explicit MainWidget(QWidget *parent = 0);
	~MainWidget();
	
protected:
	void populateCmbIcons();
	bool eventFilter(QObject *obj, QEvent *event);
	bool runCommand(QString program, QStringList arguments,
					QString &stdout, QString stderr);
	bool runCommand(QString program, QStringList arguments);
	void showNotification(QString title, QString text, int durationMs);
	void updateOutputs();
	void setBrightness();
	void adjustBrightness(int numSteps);
	QString getBrightnessMessage();
	void updateIcon();
	QString getIconResourcePath();
	void setIconResourcePath(QString value);
	void changeEvent(QEvent *e);
	void closeEvent(QCloseEvent *event);

protected slots:
	void onTrayIconActivated(QSystemTrayIcon::ActivationReason reason);
	void onTrayIconLeftClick();
	void onTrayIconMiddleClick();
	void onTrayIconRightClick();
	void onTrayIconDoubleClick();
	void onTrayIconWheel(int numSteps);
	void on_btnDecreaseBrightness_clicked();
	void on_btnIncreaseBrightness_clicked();
	void on_cmbIcon_currentIndexChanged(int index);
	void on_btnExit_clicked();

protected:
	Ui::MainWidget *ui;
	QSystemTrayIcon *trayIcon;
	QHash<QString, qreal> activeOutputBrightness;
	QList<QString> availableIcons;
	QTemporaryFile iconFile;
	QSettings settings;
};

#endif // MAINWIDGET_H
